//
//  popCover.m
//  EmReal
//
//  Created by ihope99.com on 15/5/15.
//  Copyright (c) 2015年 Hepburn. All rights reserved.
//

#import "popCover.h"

@implementation popCover
{
    popCover *_cover;
}
+(instancetype)showInRect:(CGRect)rect{

    popCover *cover= [[popCover alloc]initWithFrame:rect];
    [kKeyWindow addSubview:cover];
    return cover;
}
- (void)setDimBackground:(BOOL)dimBackground
{ _dimBackground = dimBackground;
    if (_dimBackground) {
        self.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.5];
    }else{
        self.backgroundColor = [UIColor clearColor];
    }
}

-(void)dismissCover{
    // 移除蒙版
    [UIView animateWithDuration:1 animations:^{
//        _cover.alpha = 0;
        _cover.alpha = 0;
        [self removeFromSuperview];
    } completion:^(BOOL finished) {
    }];
    // 通知外界
    if ([_delegate respondsToSelector:@selector(coverDidClickCover:)]) {
        [_delegate coverDidClickCover:self];
    }
}

@end
